<template>
  <div>
    <el-drawer
      :title="'项目风险'"
      :visible.sync="proRiskOpen"
      :before-close="cancel"
      size="68%"
      class="always_title"
    >
<!--      :withHeader="true"-->
      <div style="padding: 0 30px; height: 93%">
        <el-form
          :model="formData"
          label-position="center"
          label-width="120px"
          :size="medium"
        >
          <el-row>
            <el-col :span="8" class="grid-cell">
              <el-form-item label="项目名称" prop="projectName">
                <el-input
                  disabled
                  v-model="formData.projectName"
                  type="text"
                  clearable
                  :size="medium"
                  placeholder="请输入项目名称"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8" class="grid-cell">
              <el-form-item label="项目编码" prop="projectCode">
                <el-input
                  disabled
                  v-model="formData.projectCode"
                  type="text"
                  clearable
                  readonly
                  :size="medium"
                  placeholder="请输入项目编码"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8" class="grid-cell">
              <el-form-item label="上报人" prop="createByName">
                <el-input
                  disabled
                  v-model="formData.createByName"
                  type="text"
                  clearable
                  :size="medium"
                  placeholder="请输入上报人"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8" class="grid-cell">
              <el-form-item label="风险等级" prop="riskGrade">
                <el-select disabled v-model="formData.riskGrade" placeholder="请选择" style="width: 100%;">
                  <el-option
                    v-for="item in riskGradeOptions"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8" class="grid-cell">
              <el-form-item label="是否解决" prop="isSolve">
                <el-select disabled v-model="formData.isSolve" placeholder="请选择" style="width: 100%;">
                  <el-option
                    v-for="item in isSolveOptions"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8" class="grid-cell">
              <el-form-item label="负责人" prop="chargePersonName">
                <el-input
                  disabled
                  v-model="formData.chargePersonName"
                  type="text"
                  clearable
                  readonly
                  :size="medium"
                  placeholder="请选择负责人"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8" class="grid-cell">
              <el-form-item label="截至时间" prop="deadline" >
                <el-date-picker
                  style="width: 100%;"
                  v-model="formData.deadline"
                  type="date"
                  value-format="yyyy-MM-dd HH:mm:ss"
                  disabled
                  :size="medium"
                  placeholder="选择日期">
                </el-date-picker>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="24" class="grid-cell">
              <el-form-item
                label="风险描述"
                prop="riskDescription"
                class="sel-width"
              >
                <el-input
                  disabled
                  type="textarea"
                  :rows="4"
                  placeholder="请输入风险描述"
                  v-model="formData.riskDescription"
                >
                </el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
        <div slot="footer" class="dialog-footer" style="display: flex; justify-content: center; padding: 20px 0;">
          <el-button @click="cancel">取 消</el-button>
        </div>
      </div>
    </el-drawer>
  </div>
</template>

<script>
import {  getDailyImprovement } from "@/api/system/mis/dailyImprovement";
import {listFile, onlinePreview} from "@/api/system/mis/file";
import {download, preview} from "@/api/system/sysFileInfo/fileInfo";
import {queryByQuestId, queryHourByProjectId} from "@/api/system/mis/manHour";
import {listTech} from "@/api/system/mis/tech";
import {getInit} from "@/api/system/mis/init";
import {selectContractByProId} from "@/api/system/mis/contract";
import {listInitpsnByProId} from "@/api/system/mis/initpsn";
import moment from "moment";
import {listInitmsn, queryByProjectId} from "@/api/system/mis/initmsn";
import {getRisk, selectRiskByProId} from "@/api/system/mis/risk";
import Vue from "vue";

export default {
  name: "ProSelect",
  components: {  },
  dicts: ["sys_normal_disable", "sys_user_sex"],
  props: {
    width: {
      type: String,
      default: "900px",
    },
    height: {
      type: String,
      default: "650px",
    },
    proRiskOpen: {
      type: Boolean,
      default: false,
    },
    id: {
      type: String,
      default: undefined,
    },
  },
  computed: {},
  data() {
    return {
      formData: {},
      // 总条数
      total: 0,
      isSolveOptions: [
        {
          value: "是",
          label: "是",
        },
        {
          value: "否",
          label: "否",
        },],
      riskGradeOptions: [
        {
          value: "中",
          label: "中",
        },
        {
          value: "高",
          label: "高",
        },
        {
          value: "紧急",
          label: "紧急",
        },],
      medium:'medium',
      size: '',
      loading: false,
    };
  },
  filters: {
    formatDate: function(value) {
      if (value) {
        return moment(value).format('YYYY-MM-DD')
      }
    }
  },
  created() {
    this.getList();
  },
  watch: {
    id(row){
      this.getList()
    },
  },
  methods: {
    /** 查询项目列表 */
    getList() {
      this.loading = true;
      if (this.id !== undefined){
        getRisk(this.id).then(response => {
          this.formData = response.data;
        });
      }
    },
    cancel() {
      this.$emit("cancel");
    },
  },
};
</script>
<style>
.el-dialog__wrapper > .el-dialog {
  border-radius: 26px;
  height: 650px;
}
</style>
<style lang="scss" scoped>

.always_title {
  font-size: 20px;
  font-weight: bold;
  line-height: 53px;
  margin-left: 30px;
}
.always_title1 {
  font-size: 18px;
  font-weight: bold;
  // line-height: 53px;
  margin-left: 15px;
  position: relative;
}

.always_title1 ::before {
  content: "|";
  flex-shrink: 0;
  width: 4px;
  height: 6%;
  margin-left: 12px;
  // background: #f90;
  color: #f90;
  position: absolute;
  left: -22px;
  margin-bottom: 12px;
}

.selectBox {
  width: 100%;
  min-width: 900px;
  display: flex;
  flex-direction: column;

  .topBox {
    width: 100%;
    display: flex;
    margin-top: 10px;
    .leftBox {
      width: 280px;
      height: 400px;
      margin-right: 10px;

      -webkit-box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.12),
        0 0 6px 0 rgba(0, 0, 0, 0.04);
      box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.12), 0 0 6px 0 rgba(0, 0, 0, 0.04);
      display: flex;
      flex-direction: column;

      .leftBox_title {
        width: 100%;
        height: 40px;
        font-size: 16px;
        line-height: 40px;
        padding-left: 10px;
        background-color: #f5f5f5;
        position: relative;
        .leftBox_title_do {
          position: absolute;
          right: 16px;
          top: 8px;
        }
      }

      .contentBox {
        width: 100%;
      }
    }
  }

  .bottomBox {
    margin-top: 15px;
    width: 100%;
    height: 75px;
    // border: 1px solid #DCDFE6;
    // -webkit-box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.12), 0 0 6px 0 rgba(0, 0, 0, 0.04);
    // box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.12), 0 0 6px 0 rgba(0, 0, 0, 0.04);
    // overflow-y: auto;

    .selectPeopleList {
      width: 100%;
      display: flex;
      flex-wrap: wrap;

      .selectPeopleCard {
        width: 50px;
        height: 56px;
        display: flex;
        flex-direction: column;
        align-items: center;
        margin: 5px 10px;
        .user-avatar {
          width: 40px;
          height: 40px;
          border-radius: 50%;
          color: #fff;
          background: #ffa502;
          font-size: 14px;
          text-align: center;
          line-height: 40px;
        }

        .userInfo {
          width: 100%;
          display: flex;
          flex-direction: column;
          margin-left: 5px;
          margin-right: 5px;

          div:nth-child(1) {
            font-size: 14px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            width: 100%;
            text-align: center;
          }
        }
      }
    }
  }
}

.treeBox {
  width: 100%;
  height: 320px;
  overflow-x: hidden;
  overflow-y: auto;
}
.el-dialog{
  width: 900px;
  height: 650px;
}
.ellipsis {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
::v-deep .el-drawer__header {
  height: 35px;
  margin: 20px 30px;
  border-radius: 4px;
  border-left: 5px solid #0169ff;
  background-color: white;
  line-height: 34px;
  padding-left: 18px;
  color: #0169ff;
  background-image: linear-gradient(90deg, #f2f7ff 0%, #ffffff 95%);
  border-radius: 4px;
  font-size: 18px;
  font-weight: 500;
  padding-top: 0px;
}
::v-deep .el-drawer__header {
  min-height: 7% !important;
  height: auto;
}
//.el-dialog .dialog-paging {
//  position: absolute;
//  bottom: 40px;
//  width: 96%;
//  padding: 10px 20px; /* 根据需要调整内边距 */
//  text-align: right;
//  border-top: 0px solid #ebeef5;
//}
.peopleBox {
  width: 100%;
  height: 360px;
  overflow-x: hidden;
  overflow-y: auto;

  .peopleList {
    width: 100%;
    height: auto;

    .peopleCard:hover {
      background-color: #fafafa;
      transition: 0.2s;

      .peopleName {
        color: #eb6100;
      }
    }
    .peopleCard {
      width: 100%;
      height: 48px;
      border-top: solid #f5f5f5 1px;
      border-bottom: solid #f5f5f5 1px;
      padding-left: 8px;
      display: flex;
      align-items: center;
      cursor: pointer;
      transition: 0.2s;
      ::v-deep .el-checkbox__label {
        display: flex;
        align-items: center;
      }

      .avatarBox {
        width: 40px;
        height: 40px;

        .user-avatar {
          width: 40px;
          height: 40px;
          border-radius: 50%;
          color: #fff;
          font-size: 16px;
          text-align: center;
          line-height: 40px;
          user-select: none;
        }
      }

      .peopleInfoBox {
        width: 190px;
        height: 100%;
        display: flex;
        flex-direction: column;
        padding-left: 8px;

        .peopleName {
          width: 100%;
          height: 20px;
          white-space: nowrap;
          overflow: hidden;
          text-overflow: ellipsis;
          font-size: 16px;
          line-height: 20px;
        }

        .peopleDept {
          width: 100%;
          height: 20px;
          white-space: nowrap;
          overflow: hidden;
          text-overflow: ellipsis;
          font-size: 14px;
          line-height: 20px;
          color: #999;
        }
      }

      .peopleDeleteBtn {
        width: 20px;
        height: 20px;
        // border-radius: 50%;
        // background: url(./delete2.png) no-repeat;
        background-size: 100% 100%;
        transition: 0.2s;
      }

      .peopleDeleteBtn:hover {
        width: 20px;
        height: 20px;
        // border-radius: 50%;
        // background: url(./delete1.png) no-repeat;
        background-size: 100% 100%;
        transition: 0.2s;
      }
    }
  }
}
</style>
